package com.flower8.service.impl;

import com.flower8.dao.CreditLinkDao;
import com.flower8.dto.CreditLinkDto;
import com.flower8.model.CreditLink;
import com.flower8.service.CreditLinkService;
import com.flower8.utils.PageData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Description:
 * @Author: tanglin
 * @Date: 2019/09/25 15:51
 * @Version: 1.0
 */
@Service
public class CreditLinkServiceImpl implements CreditLinkService {
    @Autowired
    private CreditLinkDao creditLinkDao;

    /**
     * 查询银行连接列表
     * @param pd
     * @return
     * @throws Exception
     */
    @Override
    public List<CreditLinkDto> getCreditLinkList(PageData pd) throws Exception {
        return creditLinkDao.getCreditLinkList(pd);
    }

    /**
     * 查询银行连接列表数量
     * @param pd
     * @return
     * @throws Exception
     */
    @Override
    public int getCreditLinkListCount(PageData pd) throws Exception {
        return creditLinkDao.getCreditLinkListCount(pd);
    }

    /**
     * 根据id查询银行连接
     * @param id
     * @return
     * @throws Exception
     */
    @Override
    public CreditLinkDto getCreditLinkById(long id) throws Exception {
        return creditLinkDao.getCreditLinkById(id);
    }

    /**
     * 更新银行连接
     * @param creditLink
     * @throws Exception
     */
    @Override
    @Transactional
    public void updateCreditLink(CreditLink creditLink) throws Exception {
        creditLinkDao.updateCreditLink(creditLink);
    }

    /**
     * 删除银行连接
     * @param id
     * @throws Exception
     */
    @Override
    @Transactional
    public void deleteCreditLink(long id) throws Exception {
        creditLinkDao.deleteCreditLink(id);
    }

    /**
     * 新增银行连接
     * @param creditLink
     * @throws Exception
     */
    @Override
    @Transactional
    public void addCreditLink(CreditLink creditLink) throws Exception {
        creditLinkDao.addCreditLink(creditLink);
    }
}
